package service

import (
	"gitee.com/gopher2011/mall/app/dao"
)

// 全局公开对象
var SmsHomeBrand = smsHomeBrandService{}

// 私有对象，所有的方法都绑定到这个结构体上。

type smsHomeBrandService struct{}

func (p *smsHomeBrandService) Create(arg dao.SmsHomeBrandReq) (int64, error) {
	return dao.SmsHomeBrandDao.InsertTemplate(arg.List)
}

func (p *smsHomeBrandService) UpdateSort(id int64, sort int32) (int64, error) {
	return dao.SmsHomeBrandDao.UpdateSort(id, sort)
}

func (p *smsHomeBrandService) Delete(ids []int64) (int64, error) {
	return dao.SmsHomeBrandDao.Delete(ids)
}

func (p *smsHomeBrandService) UpdateRecommendStatus(ids []int64, recommendStatus int32) (int64, error) {
	return dao.SmsHomeBrandDao.UpdateRecommendStatus(ids, recommendStatus)
}

func (p *smsHomeBrandService) List(arg dao.SmsHomeBrandList) ([]dao.SmsHomeBrand, error) {
	arg.PageNum = (arg.PageNum - 1) * arg.PageSize
	return dao.SmsHomeBrandDao.List(arg)
}
